@@ -52,7 +52,7 @@ module LiquidInterpolatable |
||
52 | 52 |
|
53 | 53 |
# Escape a string for use in XPath expression |
54 | 54 |
def to_xpath(string) |
55 |
- subs = string.scan(/\G(?:\A\z|[^"]+|[^']+)/).map { |x| |
|
55 |
+ subs = string.to_s.scan(/\G(?:\A\z|[^"]+|[^']+)/).map { |x| |
|
56 | 56 |
case x |
57 | 57 |
when /"/ |
58 | 58 |
%Q{'#{x}'} |
@@ -53,5 +53,10 @@ describe LiquidInterpolatable::Filters do |
||
53 | 53 |
@filter.to_xpath_roundtrip(string).should == string |
54 | 54 |
} |
55 | 55 |
end |
56 |
+ |
|
57 |
+ it 'should stringize a non-string operand' do |
|
58 |
+ @filter.to_xpath_roundtrip(nil).should == '' |
|
59 |
+ @filter.to_xpath_roundtrip(1).should == '1' |
|
60 |
+ end |
|
56 | 61 |
end |
57 | 62 |
end |